UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'e9cJs8tcteIkgP0AF+s0Q/b8pTO3msaQgXxVQoIbhq8='
WHERE
key_id = '24b59015a8787757e6db1aff5ad8c8dcd0927a8c68c071135fb3dc4df7754e1a'
AND (
token = 'e9cJs8tcteIkgP0AF+s0Q/b8pTO3msaQgXxVQoIbhq8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)