UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'VS7w/ImSTM9ldfQt4RA1OXA+tt/GjCT8BmNTlikza18=' 
WHERE 
  key_id = '82655efa87dd13bc3185d6b49e95345bdd92d2eada3cb29e71e6ef060937d13d' 
  AND (
    token = 'VS7w/ImSTM9ldfQt4RA1OXA+tt/GjCT8BmNTlikza18=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00044