UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'b31fQjQIlxwRS5DlYGIY2uEE0FmoxZG1+Cm/Vk/d2/w=' 
WHERE 
  key_id = '18c8785efb35bcf7bca5aff3509289d193f6bb66359575a117b8b5bcdc59edc2' 
  AND (
    token = 'b31fQjQIlxwRS5DlYGIY2uEE0FmoxZG1+Cm/Vk/d2/w=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028