UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'YDDvvDKyjScR9HALz041/zD/uoZTSa3QVwH9itwTTIQ=' 
WHERE 
  key_id = '222e71583daf17d6b4e33c3f8fe51749c603037d2e2d9d6d45fe9ee5d1d64918' 
  AND (
    token = 'YDDvvDKyjScR9HALz041/zD/uoZTSa3QVwH9itwTTIQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040