UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'YdpDvxRGN/2dr8hY0SnzzaixDNhh2t0ao52CfpqRQUU=' 
WHERE 
  key_id = 'a71c61c89ff038f187a9b391b7879e8861cd50ff2bab2b24e8bae4f2cdcaea25' 
  AND (
    token = 'YdpDvxRGN/2dr8hY0SnzzaixDNhh2t0ao52CfpqRQUU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028