UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '539QAjXF74nqIoqenW5ezR+ohI05mOhlJFX1ZFwgUSY='
WHERE
key_id = '50171ca21a54a8d6b4c58a0dc6704f5ff371d519c35b4341973400fc9e12ab63'
AND (
token = '539QAjXF74nqIoqenW5ezR+ohI05mOhlJFX1ZFwgUSY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)