UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'gTdO4jF/JtE9raGWslHLEdpcmLXkH8YehaGUBro7HH8='
WHERE
key_id = '84492ad1bfbdce56e6c1b457e8e235fe4166e165dc1cdadc24c2688644f050b3'
AND (
token = 'gTdO4jF/JtE9raGWslHLEdpcmLXkH8YehaGUBro7HH8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)