UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ugXAGd+eicGBc8N5Y9+tUIp5CIufM5lWPlS+4PQm/0g='
WHERE
key_id = 'e6dca88f6e724f84817893b1afa77826c4197a6006a83f2d5a146017e9311470'
AND (
token = 'ugXAGd+eicGBc8N5Y9+tUIp5CIufM5lWPlS+4PQm/0g='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)