UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '5Z9LGQcrk72jb5uMKaePtevBwX+aSsJyrhaW8XkUslc='
WHERE
key_id = 'f85b13ff7d73accd427af79d84ffe0a394570b57abadc9e3b8e85e1c6171a66d'
AND (
token = '5Z9LGQcrk72jb5uMKaePtevBwX+aSsJyrhaW8XkUslc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)