UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'dqpkcx+km6frf6xUNVi5ODHWdU0+/6AF6Y1YpYFweok='
WHERE
key_id = '4c8314f36d25f4c32d0f877294d76d7d3e17267acbf7e8117f76b6d329eaca40'
AND (
token = 'dqpkcx+km6frf6xUNVi5ODHWdU0+/6AF6Y1YpYFweok='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)