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