UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'e2fUMC/tOIumrYbCdlFUTXhwUBtvrz/0qD5Xgf7+Ehc=' 
WHERE 
  key_id = '10024417bc971b368c0de97f1af11332a65a023b2619c2b3cd0463c92ed1d02d' 
  AND (
    token = 'e2fUMC/tOIumrYbCdlFUTXhwUBtvrz/0qD5Xgf7+Ehc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034