UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'KW6aWiWf8QkULVRr+MAIvrK2aUpu9x/87UxbI2l26ZE='
WHERE
key_id = 'f180f06b93a1ae32a4e18242f78b5bee67b612cbce40700b592c0cfcdb8fc9d1'
AND (
token = 'KW6aWiWf8QkULVRr+MAIvrK2aUpu9x/87UxbI2l26ZE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)