UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 's9XWFkFpteFiav5Wjrr4IdvhqMjmFmKWO+ThPleMuX0='
WHERE
key_id = '1ea850b2ba9b9a48f1790edc4d7f95d0808fd71d632b5416f0f198294702a58e'
AND (
token = 's9XWFkFpteFiav5Wjrr4IdvhqMjmFmKWO+ThPleMuX0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)