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