UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'QXHCg9vdugzhIM2U78m1qrJjXtVRaoSTYmCyYcYq6Fw=' 
WHERE 
  key_id = '7ea1e6e8228a88888e9598121863d19bb436fb5754f5e68fbd9580d47a393ffc' 
  AND (
    token = 'QXHCg9vdugzhIM2U78m1qrJjXtVRaoSTYmCyYcYq6Fw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038