UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'YSZs2YrkBnMCILN9OXTBbH+kax5YG20ZOtXs0w+wm18='
WHERE
key_id = '90aaee1144792501d173b6b8cc4a7a075e4efcd98798a4634d2196580ca2b900'
AND (
token = 'YSZs2YrkBnMCILN9OXTBbH+kax5YG20ZOtXs0w+wm18='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)