UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'nuwV3q92DDNjsxN+kMUgFTabGB8frWBkrgn61kqcq+w=' 
WHERE 
  key_id = '04a258a6d0fe4df72d39c484f4513ba39820840d675fbb28b832fc618e36fce7' 
  AND (
    token = 'nuwV3q92DDNjsxN+kMUgFTabGB8frWBkrgn61kqcq+w=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027