UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'eLhlPAgi3kKqVPBRCNhiWoI46LltDXjLa5olVZFCcuo='
WHERE
key_id = '3bd95e37b5b02f227eedef8b6eabff07a482bc72af6f88708fe5b5ce52487cdc'
AND (
token = 'eLhlPAgi3kKqVPBRCNhiWoI46LltDXjLa5olVZFCcuo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)