UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ueyfYriyIA031MFJkXB/OiyubIFJzvLf4rh10FmkVcQ=' 
WHERE 
  key_id = 'd882758a44d71acd76bcdbe37603472be3aeee4f539b42841c048139f0b25b48' 
  AND (
    token = 'ueyfYriyIA031MFJkXB/OiyubIFJzvLf4rh10FmkVcQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026