UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'P6MrQjJZ+o95096C9etYLO6qySAG6S/WOQayXSa4v5w='
WHERE
key_id = '0efacc713336523572e28e8f7b16e02be9a67e88589c46c3a1ce84ed01a14d73'
AND (
token = 'P6MrQjJZ+o95096C9etYLO6qySAG6S/WOQayXSa4v5w='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)