UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'RF4ER9YHdcWsOjhAHCP3o062KPEntTioRmRFkgB1lDQ='
WHERE
key_id = 'cc60a8f7a1943650c1575b91e2c27b5781cb512e12f94070b404bfe03ae44aad'
AND (
token = 'RF4ER9YHdcWsOjhAHCP3o062KPEntTioRmRFkgB1lDQ='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)