UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'YMc13ZXoCI/gfwI6IRLW5Cxqe4ThtgBUykeEBelO+EM=' 
WHERE 
  key_id = '3af6b7d4cd29ad87a449f299c9eedb7c4dfde406eadd1e79ebc5f74e7a87ed6f' 
  AND (
    token = 'YMc13ZXoCI/gfwI6IRLW5Cxqe4ThtgBUykeEBelO+EM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029