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

Query time 0.00037