UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'gU04/83zq6gxyFlajoKXsZUQbdiFoaRVL52OQDmO8ek=' 
WHERE 
  key_id = '044e1b4dc22b6903c34877e6c82f565b7b368b958be97609e80bda041530bf66' 
  AND (
    token = 'gU04/83zq6gxyFlajoKXsZUQbdiFoaRVL52OQDmO8ek=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00020