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