UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'S+Qd7sjoJ8E37J4zTVvBMNEonn3jgD02CtTCD45l0Xc='
WHERE
key_id = 'fddfa5e73527ad7038d7e040a8aaeaffcb286e74016068b5476e72cc925aed3a'
AND (
token = 'S+Qd7sjoJ8E37J4zTVvBMNEonn3jgD02CtTCD45l0Xc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)