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