UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'J1z89yKELy+OAdRWPtbun6WvLV1EOt0/nsqH45UL/8s='
WHERE
key_id = '27114864881b9c96e9f1d12eb28ee51f9de6e39744438e9f7d836a5ee1e14dcb'
AND (
token = 'J1z89yKELy+OAdRWPtbun6WvLV1EOt0/nsqH45UL/8s='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)