UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '5UTqwR5KSGcRwSUhcXQGK1sBO8EuD58EUgwckWBBpN4='
WHERE
key_id = 'd1434318d29069ebfd8d011afe5bcee3b59900a8cb0618688ba37f7584a08218'
AND (
token = '5UTqwR5KSGcRwSUhcXQGK1sBO8EuD58EUgwckWBBpN4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)