UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '8ZbuMX10goTVel+NiS/SpJHcWCQpQ0yDEW5q4jG1izw='
WHERE
key_id = '9ab81685bc77cef7ab00aaf4e35896231932d92c5a9567297a06e176de35cd0f'
AND (
token = '8ZbuMX10goTVel+NiS/SpJHcWCQpQ0yDEW5q4jG1izw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)