UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '70oqVAPpUYvJaIuMIS3PQpmjh9kwpLuErNypfx9Aoo8='
WHERE
key_id = '326b5589aed5d85f11b9252bc6ea08eee6b0a48ff1eb66feaf34cb1fa598aa25'
AND (
token = '70oqVAPpUYvJaIuMIS3PQpmjh9kwpLuErNypfx9Aoo8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)