UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'pJtL/RU4ArMzl5GB9pCwzgn2mWdZSSgSF7s2DK/3WYc='
WHERE
key_id = 'dd5199a86e868debfe65df91fae2f982086c367f9a0b5ed319a80d73b4cf0651'
AND (
token = 'pJtL/RU4ArMzl5GB9pCwzgn2mWdZSSgSF7s2DK/3WYc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)