UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'T562wkRjJ/xra8vo32Jvc3/YckiUmpcCwarM5o+phXI='
WHERE
key_id = 'b4c907fc88378d33b63a541dc245ec66874837306aa20763777315277780351d'
AND (
token = 'T562wkRjJ/xra8vo32Jvc3/YckiUmpcCwarM5o+phXI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)