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