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