UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 300,
token = 'nAfOIZvtVpLTGW/bCAB+wNtypC+Yv7ux+I5yRrgg3Z4='
WHERE
key_id = 'ac5c15ae823a856b27eda11bfd170eb10e680a932a1f7194807cd1efc06a5858'
AND (
token = 'nAfOIZvtVpLTGW/bCAB+wNtypC+Yv7ux+I5yRrgg3Z4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)