UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'vmlemF+FSgXsdg/0qyuqQNVrlm87FzeztOWbdo5NOo4='
WHERE
key_id = 'c7d4889cb63dec5ee3b9766829546ccf9b57e8e267d8f241fea6b7a17bd7dc5c'
AND (
token = 'vmlemF+FSgXsdg/0qyuqQNVrlm87FzeztOWbdo5NOo4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)