UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'qsrnBQ5Jch+Ep6AYLUx7ICTuuYPXCbQR+UDYdC+jbJo=' 
WHERE 
  key_id = '8386a932d95b444324e241b8d60df891e6366706334b719984b4d635f7abfaec' 
  AND (
    token = 'qsrnBQ5Jch+Ep6AYLUx7ICTuuYPXCbQR+UDYdC+jbJo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00047