UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'EH1OS9XCBUts6RRfZuf11l/sNx/7VDHgB5gAW5A7v50='
WHERE
key_id = '34676187f2affc003872e9cad6d30ba8c23a2e52901d72a4f06680e47c045ae3'
AND (
token = 'EH1OS9XCBUts6RRfZuf11l/sNx/7VDHgB5gAW5A7v50='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)