UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '0wYn5CvCh7jNyAlXMyKDZ14ZhSWFvSP7t6MGM7w6VyQ=' 
WHERE 
  key_id = '80964733bfc21a7c59d01fbb786f7d09644c7d2265358c60278095652355806f' 
  AND (
    token = '0wYn5CvCh7jNyAlXMyKDZ14ZhSWFvSP7t6MGM7w6VyQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033