UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'OUT94cER01usaOBL1EyjXnVa+XTg3P2/w75/xXDs1eA=' 
WHERE 
  key_id = '3a6f662333b4755cfd1cbcddf6235ba20c8da87176988334584950225a2c5a13' 
  AND (
    token = 'OUT94cER01usaOBL1EyjXnVa+XTg3P2/w75/xXDs1eA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038